#include <vector>
using namespace std;
class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> v;
        if(1 == numRows)
        {
            v.push_back({1});
            return v;
        }
        v.resize(numRows);
        v[0].resize(1,1);
        for(int i = 1;i<numRows;i++)
        {
            for(int j =0;j<=i;j++)
            {
                if(0 == j || j == i)
                {
                v[i].emplace_back(1); //注意emplace_back和push_back
                continue;
                }
                v[i].emplace_back(v[i-1][j-1]+v[i-1][j]);
            }
        }
        return v;
    }
};